<!-- saved from url=(0014)about:internet -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Logger.as</title>
<link rel="stylesheet" type="text/css" href="../SourceStyles.css"/>
</head>

<body><pre><span class="ActionScriptpackage">package</span> <span class="ActionScriptBracket/Brace">{</span>
    <span class="ActionScriptComment">/*
    This library compatible with projects
    http://www.docsultant.com/site2/articles/flex_xpanel.html - XPanel for FLEX/Flash
    https://addons.mozilla.org/en-US/firefox/addon/1843 - Mozilla FireFox (FireBug pluggin)
    http://code.google.com/p/flash-thunderbolt - ThunderBolt AS3 Console
    */</span>
    
    <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">flash</span>.<span class="ActionScriptDefault_Text">display</span>.<span class="ActionScriptDefault_Text">Sprite</span>;
    <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">flash</span>.<span class="ActionScriptDefault_Text">events</span>.<span class="ActionScriptDefault_Text">StatusEvent</span>;
    <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">flash</span>.<span class="ActionScriptDefault_Text">external</span>.<span class="ActionScriptDefault_Text">ExternalInterface</span>;
    <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">flash</span>.<span class="ActionScriptDefault_Text">net</span>.<span class="ActionScriptDefault_Text">LocalConnection</span>;
    <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">flash</span>.<span class="ActionScriptDefault_Text">utils</span>.<span class="ActionScriptDefault_Text">clearInterval</span>;
    <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">flash</span>.<span class="ActionScriptDefault_Text">utils</span>.<span class="ActionScriptDefault_Text">describeType</span>;
    <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">flash</span>.<span class="ActionScriptDefault_Text">utils</span>.<span class="ActionScriptDefault_Text">getQualifiedClassName</span>;
    <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">flash</span>.<span class="ActionScriptDefault_Text">utils</span>.<span class="ActionScriptDefault_Text">getTimer</span>;
    <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">flash</span>.<span class="ActionScriptDefault_Text">utils</span>.<span class="ActionScriptDefault_Text">setInterval</span>;
    <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">flash</span>.<span class="ActionScriptDefault_Text">xml</span>.<span class="ActionScriptDefault_Text">XMLNode</span>;

    <span class="ActionScriptReserved">public</span> <span class="ActionScriptclass">class</span> <span class="ActionScriptDefault_Text">Logger</span> <span class="ActionScriptReserved">extends</span> <span class="ActionScriptDefault_Text">Sprite</span>
    <span class="ActionScriptBracket/Brace">{</span>
        <span class="ActionScriptReserved">private</span> <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">_level</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">int</span>;
        <span class="ActionScriptReserved">private</span> <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">_type</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span>;
    
        <span class="ActionScriptReserved">private</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">_xpanel_lc</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">LocalConnection</span>;
        <span class="ActionScriptReserved">private</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">_localConnectionClient</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Object</span>;

        <span class="ActionScriptReserved">private</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptReserved">const</span> <span class="ActionScriptDefault_Text">xpanelConnectionName</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptString">&quot;_xpanel1&quot;</span>;
        <span class="ActionScriptReserved">private</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptReserved">const</span> <span class="ActionScriptDefault_Text">loggerConnectionName</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptString">&quot;_logger&quot;</span>;
        
        <span class="ActionScriptReserved">public</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptReserved">const</span> <span class="ActionScriptDefault_Text">LOGGER_DEBUG</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Logger</span>       <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">Logger</span><span class="ActionScriptBracket/Brace">(</span>0<span class="ActionScriptDefault_Text">x01</span>, <span class="ActionScriptString">&quot;log&quot;</span><span class="ActionScriptBracket/Brace">)</span>;
        <span class="ActionScriptReserved">public</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptReserved">const</span> <span class="ActionScriptDefault_Text">LOGGER_INFORMATION</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Logger</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">Logger</span><span class="ActionScriptBracket/Brace">(</span>0<span class="ActionScriptDefault_Text">x02</span>, <span class="ActionScriptString">&quot;info&quot;</span><span class="ActionScriptBracket/Brace">)</span>;
        <span class="ActionScriptReserved">public</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptReserved">const</span> <span class="ActionScriptDefault_Text">LOGGER_WARNING</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Logger</span>     <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">Logger</span><span class="ActionScriptBracket/Brace">(</span>0<span class="ActionScriptDefault_Text">x04</span>, <span class="ActionScriptString">&quot;warn&quot;</span><span class="ActionScriptBracket/Brace">)</span>;
        <span class="ActionScriptReserved">public</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptReserved">const</span> <span class="ActionScriptDefault_Text">LOGGER_ERROR</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Logger</span>       <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">Logger</span><span class="ActionScriptBracket/Brace">(</span>0<span class="ActionScriptDefault_Text">x08</span>, <span class="ActionScriptString">&quot;error&quot;</span><span class="ActionScriptBracket/Brace">)</span>;
        
        <span class="ActionScriptReserved">public</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptReserved">const</span> <span class="ActionScriptDefault_Text">EXTERNAL_LOG_CHANNEL</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">int</span> <span class="ActionScriptOperator">=</span>  0; 
        
        <span class="ActionScriptReserved">private</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptReserved">const</span> <span class="ActionScriptDefault_Text">CHAR_LIMIT</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">uint</span> <span class="ActionScriptOperator">=</span> 40000; <span class="ActionScriptComment">//LocalConnection error: 2084 The AMF encoding of the arguments cannot exceed 40K. 
</span>        <span class="ActionScriptReserved">private</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptReserved">const</span> <span class="ActionScriptDefault_Text">ARRAY_DELIMITER</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptString">&quot;\u00B6&quot;</span>;
        
        <span class="ActionScriptReserved">private</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">_js_bridge_initialized</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Boolean</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">false</span>;
        <span class="ActionScriptReserved">private</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">_connectionInterval</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Number</span>;
        
        <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">Logger</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">level</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">int</span><span class="ActionScriptOperator">=-</span>1, <span class="ActionScriptDefault_Text">type</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span><span class="ActionScriptOperator">=</span><span class="ActionScriptReserved">null</span><span class="ActionScriptBracket/Brace">){</span>
            <span class="ActionScriptReserved">if</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">_js_bridge_initialized</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptReserved">false</span> <span class="ActionScriptOperator">&amp;&amp;</span> <span class="ActionScriptDefault_Text">ExternalInterface</span>.<span class="ActionScriptDefault_Text">available</span><span class="ActionScriptBracket/Brace">){</span>
                <span class="ActionScriptDefault_Text">ExternalInterface</span>.<span class="ActionScriptDefault_Text">addCallback</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">&quot;js_trace&quot;</span>, <span class="ActionScriptDefault_Text">js_trace</span><span class="ActionScriptBracket/Brace">)</span>;
                <span class="ActionScriptDefault_Text">_js_bridge_initialized</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">true</span>;
            <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">_level</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">level</span>;
            <span class="ActionScriptReserved">this</span>.<span class="ActionScriptDefault_Text">_type</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">type</span>;
        <span class="ActionScriptBracket/Brace">}</span>
        
        <span class="ActionScriptReserved">public</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptReserved">get</span> <span class="ActionScriptDefault_Text">level</span><span class="ActionScriptBracket/Brace">()</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">int</span><span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptReserved">return</span> <span class="ActionScriptDefault_Text">_level</span>;
        <span class="ActionScriptBracket/Brace">}</span>
        
        <span class="ActionScriptReserved">public</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptReserved">get</span> <span class="ActionScriptDefault_Text">type</span><span class="ActionScriptBracket/Brace">()</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span><span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptReserved">return</span> <span class="ActionScriptDefault_Text">_type</span>;
        <span class="ActionScriptBracket/Brace">}</span>

        <span class="ActionScriptReserved">public</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">alert</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">o</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Object</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span><span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptDefault_Text">ExternalInterface</span>.<span class="ActionScriptDefault_Text">call</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">&quot;alert&quot;</span>, <span class="ActionScriptDefault_Text">toString</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">o</span><span class="ActionScriptBracket/Brace">))</span>;
        <span class="ActionScriptBracket/Brace">}</span>
        
        <span class="ActionScriptReserved">public</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">debug</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">o</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Object</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span><span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptDefault_Text">_send</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">LOGGER_DEBUG</span>, <span class="ActionScriptDefault_Text">o</span><span class="ActionScriptBracket/Brace">)</span>;
        <span class="ActionScriptBracket/Brace">}</span>

        <span class="ActionScriptReserved">public</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">info</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">o</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Object</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span><span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptDefault_Text">_send</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">LOGGER_INFORMATION</span>, <span class="ActionScriptDefault_Text">o</span><span class="ActionScriptBracket/Brace">)</span>;
        <span class="ActionScriptBracket/Brace">}</span>

        <span class="ActionScriptReserved">public</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">error</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">o</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Object</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span><span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptDefault_Text">_send</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">LOGGER_ERROR</span>, <span class="ActionScriptDefault_Text">o</span><span class="ActionScriptBracket/Brace">)</span>;
        <span class="ActionScriptBracket/Brace">}</span>

        <span class="ActionScriptReserved">public</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">warn</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">o</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Object</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span><span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptDefault_Text">_send</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">LOGGER_WARNING</span>, <span class="ActionScriptDefault_Text">o</span><span class="ActionScriptBracket/Brace">)</span>;
        <span class="ActionScriptBracket/Brace">}</span>

        <span class="ActionScriptReserved">public</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">params</span><span class="ActionScriptBracket/Brace">(</span>... <span class="ActionScriptDefault_Text">args</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span><span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptDefault_Text">_send</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">LOGGER_DEBUG</span>, <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">args</span> <span class="ActionScriptReserved">is</span> <span class="ActionScriptDefault_Text">Array</span> <span class="ActionScriptOperator">?</span> <span class="ActionScriptDefault_Text">args</span>.<span class="ActionScriptDefault_Text">join</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">&quot;, &quot;</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptOperator">:</span> <span class="ActionScriptDefault_Text">args</span><span class="ActionScriptBracket/Brace">))</span>;
        <span class="ActionScriptBracket/Brace">}</span>
        
        <span class="ActionScriptReserved">private</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">js_trace</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">type</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span><span class="ActionScriptOperator">=</span><span class="ActionScriptString">&quot;log&quot;</span>, <span class="ActionScriptDefault_Text">o</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Object</span><span class="ActionScriptOperator">=</span><span class="ActionScriptReserved">null</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span><span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">loggers</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Array</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptDefault_Text">LOGGER_DEBUG</span>, <span class="ActionScriptDefault_Text">LOGGER_INFORMATION</span>, <span class="ActionScriptDefault_Text">LOGGER_WARNING</span>, <span class="ActionScriptDefault_Text">LOGGER_ERROR</span><span class="ActionScriptBracket/Brace">]</span>;
            <span class="ActionScriptReserved">for</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">i</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">uint</span> <span class="ActionScriptOperator">=</span> 0; <span class="ActionScriptDefault_Text">i</span> <span class="ActionScriptOperator">&lt;</span> <span class="ActionScriptDefault_Text">loggers</span>.<span class="ActionScriptDefault_Text">length</span>; <span class="ActionScriptDefault_Text">i</span><span class="ActionScriptOperator">++</span><span class="ActionScriptBracket/Brace">){</span>
                <span class="ActionScriptReserved">if</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">loggers</span><span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptDefault_Text">i</span><span class="ActionScriptBracket/Brace">]</span>.<span class="ActionScriptDefault_Text">type</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptDefault_Text">type</span><span class="ActionScriptBracket/Brace">){</span>
                    <span class="ActionScriptDefault_Text">_send</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">loggers</span><span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptDefault_Text">i</span><span class="ActionScriptBracket/Brace">]</span> <span class="ActionScriptReserved">as</span> <span class="ActionScriptDefault_Text">Logger</span>, <span class="ActionScriptDefault_Text">o</span><span class="ActionScriptBracket/Brace">)</span>;
                    <span class="ActionScriptReserved">return</span>;
                <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptDefault_Text">ExternalInterface</span>.<span class="ActionScriptDefault_Text">call</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">&quot;console.&quot;</span> <span class="ActionScriptOperator">+</span> <span class="ActionScriptDefault_Text">type</span>, <span class="ActionScriptDefault_Text">formatDate</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">Date</span><span class="ActionScriptBracket/Brace">())</span> <span class="ActionScriptOperator">+</span> <span class="ActionScriptString">&quot;  &quot;</span> <span class="ActionScriptOperator">+</span> <span class="ActionScriptDefault_Text">o</span><span class="ActionScriptBracket/Brace">)</span>;
        <span class="ActionScriptBracket/Brace">}</span>

        <span class="ActionScriptReserved">public</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">send</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">channel</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">uint</span>, ...<span class="ActionScriptDefault_Text">args</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span><span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptReserved">if</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">_localConnectionClient</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptReserved">null</span><span class="ActionScriptBracket/Brace">)</span>
                <span class="ActionScriptDefault_Text">_localConnectionClient</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">_connect</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptOperator">-</span>1<span class="ActionScriptBracket/Brace">)</span>.<span class="ActionScriptDefault_Text">client</span>;
            <span class="ActionScriptDefault_Text">_localConnectionClient</span>.<span class="ActionScriptDefault_Text">$send</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">args</span>, <span class="ActionScriptDefault_Text">channel</span><span class="ActionScriptBracket/Brace">)</span>;
        <span class="ActionScriptBracket/Brace">}</span>

        <span class="ActionScriptReserved">private</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">_send</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">logger</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Logger</span>, <span class="ActionScriptDefault_Text">o</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Object</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span><span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptReserved">try</span><span class="ActionScriptBracket/Brace">{</span>
                <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">str</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptReserved">typeof</span> <span class="ActionScriptDefault_Text">o</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptString">&quot;xml&quot;</span> <span class="ActionScriptOperator">?</span> <span class="ActionScriptDefault_Text">o</span>.<span class="ActionScriptDefault_Text">toXMLString</span><span class="ActionScriptBracket/Brace">()</span> <span class="ActionScriptOperator">:</span> <span class="ActionScriptDefault_Text">toString</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">o</span><span class="ActionScriptBracket/Brace">))</span>;
                <span class="ActionScriptComment">//Send message to Flex Logger
</span>                <span class="ActionScriptDefault_Text">send</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">EXTERNAL_LOG_CHANNEL</span>, <span class="ActionScriptDefault_Text">getTimer</span><span class="ActionScriptBracket/Brace">()</span>, <span class="ActionScriptDefault_Text">str</span>, <span class="ActionScriptDefault_Text">logger</span>.<span class="ActionScriptDefault_Text">level</span><span class="ActionScriptBracket/Brace">)</span>;
                <span class="ActionScriptComment">//Send message to FireBug console
</span>                <span class="ActionScriptDefault_Text">ExternalInterface</span>.<span class="ActionScriptDefault_Text">call</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">&quot;console.&quot;</span> <span class="ActionScriptOperator">+</span> <span class="ActionScriptDefault_Text">logger</span>.<span class="ActionScriptDefault_Text">type</span>, <span class="ActionScriptDefault_Text">formatDate</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">Date</span><span class="ActionScriptBracket/Brace">())</span> <span class="ActionScriptOperator">+</span> <span class="ActionScriptString">&quot;  &quot;</span> <span class="ActionScriptOperator">+</span> <span class="ActionScriptDefault_Text">str</span><span class="ActionScriptBracket/Brace">)</span>;
                <span class="ActionScriptComment">//Send message to XPanel
</span>                <span class="ActionScriptReserved">if</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">_xpanel_lc</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptReserved">null</span><span class="ActionScriptBracket/Brace">){</span>
                    <span class="ActionScriptDefault_Text">_xpanel_lc</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">LocalConnection</span><span class="ActionScriptBracket/Brace">()</span>;
                    <span class="ActionScriptDefault_Text">_xpanel_lc</span>.<span class="ActionScriptDefault_Text">allowDomain</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">&quot;*&quot;</span><span class="ActionScriptBracket/Brace">)</span>;
                <span class="ActionScriptBracket/Brace">}</span>
                <span class="ActionScriptReserved">if</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">str</span> <span class="ActionScriptOperator">&amp;&amp;</span> <span class="ActionScriptDefault_Text">str</span>.<span class="ActionScriptDefault_Text">length</span> <span class="ActionScriptOperator">&gt;</span> <span class="ActionScriptDefault_Text">CHAR_LIMIT</span><span class="ActionScriptBracket/Brace">)</span>
                    <span class="ActionScriptDefault_Text">str</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">str</span>.<span class="ActionScriptDefault_Text">substring</span><span class="ActionScriptBracket/Brace">(</span>0, <span class="ActionScriptDefault_Text">CHAR_LIMIT</span><span class="ActionScriptBracket/Brace">)</span>; 
                <span class="ActionScriptDefault_Text">_xpanel_lc</span>.<span class="ActionScriptDefault_Text">addEventListener</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">StatusEvent</span>.<span class="ActionScriptDefault_Text">STATUS</span>, <span class="ActionScriptfunction">function</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">event</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">StatusEvent</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span><span class="ActionScriptBracket/Brace">{})</span>;
                <span class="ActionScriptDefault_Text">_xpanel_lc</span>.<span class="ActionScriptDefault_Text">send</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">xpanelConnectionName</span>, <span class="ActionScriptString">&quot;dispatchMessage&quot;</span>, <span class="ActionScriptDefault_Text">getTimer</span><span class="ActionScriptBracket/Brace">()</span>, <span class="ActionScriptDefault_Text">str</span>, <span class="ActionScriptDefault_Text">logger</span>.<span class="ActionScriptDefault_Text">level</span><span class="ActionScriptBracket/Brace">)</span>;
            <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptReserved">catch</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">err</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Error</span><span class="ActionScriptBracket/Brace">){</span>
                <span class="ActionScriptComment">// ignored.
</span>            <span class="ActionScriptBracket/Brace">}</span>
        <span class="ActionScriptBracket/Brace">}</span>
        
        <span class="ActionScriptComment">//Sets response listener. If channel equals to EXTERNAL_LOG_CHANNEL (0), class will received all log messages passed from external application. 
</span>        <span class="ActionScriptReserved">public</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">connect</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">resultHandler</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Function</span><span class="ActionScriptOperator">=</span><span class="ActionScriptReserved">null</span>, <span class="ActionScriptDefault_Text">statusHandler</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Function</span><span class="ActionScriptOperator">=</span><span class="ActionScriptReserved">null</span>, <span class="ActionScriptDefault_Text">channel</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">uint</span><span class="ActionScriptOperator">=</span><span class="ActionScriptDefault_Text">EXTERNAL_LOG_CHANNEL</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">LocalConnection</span><span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptReserved">return</span> <span class="ActionScriptDefault_Text">_connect</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">channel</span>, <span class="ActionScriptDefault_Text">resultHandler</span>, <span class="ActionScriptDefault_Text">statusHandler</span><span class="ActionScriptBracket/Brace">)</span>;
        <span class="ActionScriptBracket/Brace">}</span>
        
        <span class="ActionScriptReserved">private</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">_connect</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">channel</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">int</span>, <span class="ActionScriptDefault_Text">resultHandler</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Function</span><span class="ActionScriptOperator">=</span><span class="ActionScriptReserved">null</span>, <span class="ActionScriptDefault_Text">statusHandler</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Function</span><span class="ActionScriptOperator">=</span><span class="ActionScriptReserved">null</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">LocalConnection</span><span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">message</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span>;
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">lastStatus</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span>;
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">lc</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">LocalConnection</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">LocalConnection</span><span class="ActionScriptBracket/Brace">()</span>;
            <span class="ActionScriptDefault_Text">lc</span>.<span class="ActionScriptDefault_Text">allowDomain</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">&quot;*&quot;</span><span class="ActionScriptBracket/Brace">)</span>;
            <span class="ActionScriptDefault_Text">lc</span>.<span class="ActionScriptDefault_Text">client</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptBracket/Brace">{</span><span class="ActionScriptDefault_Text">$result</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">resultHandler</span>, <span class="ActionScriptDefault_Text">$status</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">statusHandler</span>, <span class="ActionScriptDefault_Text">$channel</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">channel</span><span class="ActionScriptBracket/Brace">}</span>;
            <span class="ActionScriptDefault_Text">lc</span>.<span class="ActionScriptDefault_Text">addEventListener</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">StatusEvent</span>.<span class="ActionScriptDefault_Text">STATUS</span>, 
                <span class="ActionScriptfunction">function</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">event</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">StatusEvent</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span><span class="ActionScriptBracket/Brace">{</span>
                    <span class="ActionScriptReserved">if</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">lastStatus</span> <span class="ActionScriptOperator">!=</span> <span class="ActionScriptDefault_Text">event</span>.<span class="ActionScriptDefault_Text">level</span> <span class="ActionScriptOperator">&amp;&amp;</span> <span class="ActionScriptDefault_Text">event</span>.<span class="ActionScriptDefault_Text">level</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptString">&quot;error&quot;</span> <span class="ActionScriptOperator">&amp;&amp;</span> 
                                <span class="ActionScriptDefault_Text">event</span>.<span class="ActionScriptDefault_Text">target</span>.<span class="ActionScriptDefault_Text">client</span>.<span class="ActionScriptDefault_Text">hasOwnProperty</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">&apos;request&apos;</span><span class="ActionScriptBracket/Brace">)){</span>
                        <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">channel</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">int</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">event</span>.<span class="ActionScriptDefault_Text">target</span>.<span class="ActionScriptDefault_Text">client</span>.<span class="ActionScriptDefault_Text">$channel</span>;
                        <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">request</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Object</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">event</span>.<span class="ActionScriptDefault_Text">target</span>.<span class="ActionScriptDefault_Text">client</span>.<span class="ActionScriptDefault_Text">request</span>;
                        <span class="ActionScriptReserved">if</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">request</span>.<span class="ActionScriptDefault_Text">channel</span> <span class="ActionScriptOperator">!=</span> <span class="ActionScriptDefault_Text">EXTERNAL_LOG_CHANNEL</span><span class="ActionScriptBracket/Brace">)</span>                
                            <span class="ActionScripttrace">trace</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">&quot;Warning Undeliverable Messages: &quot;</span> <span class="ActionScriptOperator">+</span> <span class="ActionScriptDefault_Text">channel</span> <span class="ActionScriptOperator">+</span> <span class="ActionScriptString">&quot; -&gt; &quot;</span> <span class="ActionScriptOperator">+</span> <span class="ActionScriptDefault_Text">request</span>.<span class="ActionScriptDefault_Text">channel</span> <span class="ActionScriptOperator">+</span> <span class="ActionScriptString">&quot;\n&quot;</span> <span class="ActionScriptOperator">+</span> <span class="ActionScriptDefault_Text">request</span>.<span class="ActionScriptDefault_Text">params</span><span class="ActionScriptBracket/Brace">)</span>;
                    <span class="ActionScriptBracket/Brace">}</span>
                    <span class="ActionScriptDefault_Text">lastStatus</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">event</span>.<span class="ActionScriptDefault_Text">level</span>;
                <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptBracket/Brace">)</span>;
            <span class="ActionScriptComment">//Workaround against Adobe bug: https://bugs.adobe.com/jira/browse/SDK-13565
</span>            <span class="ActionScriptDefault_Text">lc</span>.<span class="ActionScriptDefault_Text">client</span>.<span class="ActionScriptDefault_Text">$send</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptfunction">function</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">params</span><span class="ActionScriptOperator">:*</span>, <span class="ActionScriptDefault_Text">channel</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">int</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span><span class="ActionScriptBracket/Brace">{</span>
                <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">msg</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">params</span> <span class="ActionScriptReserved">is</span> <span class="ActionScriptDefault_Text">Array</span> <span class="ActionScriptOperator">?</span> <span class="ActionScriptDefault_Text">params</span>.<span class="ActionScriptDefault_Text">join</span><span class="ActionScriptBracket/Brace">(A</span><span class="ActionScriptDefault_Text">RRAY_DELIMITER</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptOperator">:</span> <span class="ActionScriptDefault_Text">String</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">params</span><span class="ActionScriptBracket/Brace">))</span>;
                <span class="ActionScriptDefault_Text">lc</span>.<span class="ActionScriptDefault_Text">client</span>.<span class="ActionScriptDefault_Text">request</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptBracket/Brace">{</span><span class="ActionScriptDefault_Text">channel</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">channel</span>, <span class="ActionScriptDefault_Text">params</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">params</span><span class="ActionScriptBracket/Brace">}</span>
                <span class="ActionScriptDefault_Text">lc</span>.<span class="ActionScriptDefault_Text">send</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">loggerConnectionName</span> <span class="ActionScriptOperator">+</span> <span class="ActionScriptDefault_Text">channel</span>, <span class="ActionScriptString">&quot;$progress&quot;</span>, <span class="ActionScriptString">&quot;INIT_STATUS&quot;</span><span class="ActionScriptBracket/Brace">)</span>;
                <span class="ActionScriptReserved">while</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">msg</span> <span class="ActionScriptOperator">&amp;&amp;</span> <span class="ActionScriptDefault_Text">msg</span>.<span class="ActionScriptDefault_Text">length</span><span class="ActionScriptBracket/Brace">){</span>
                    <span class="ActionScriptDefault_Text">lc</span>.<span class="ActionScriptDefault_Text">send</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">loggerConnectionName</span> <span class="ActionScriptOperator">+</span> <span class="ActionScriptDefault_Text">channel</span>, <span class="ActionScriptString">&quot;$progress&quot;</span>, <span class="ActionScriptString">&quot;SENDING_STATUS&quot;</span>, <span class="ActionScriptDefault_Text">msg</span>.<span class="ActionScriptDefault_Text">substring</span><span class="ActionScriptBracket/Brace">(</span>0, <span class="ActionScriptDefault_Text">Logger</span>.<span class="ActionScriptDefault_Text">CHAR_LIMIT</span><span class="ActionScriptBracket/Brace">))</span>;
                    <span class="ActionScriptDefault_Text">msg</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">msg</span>.<span class="ActionScriptDefault_Text">substring</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">Logger</span>.<span class="ActionScriptDefault_Text">CHAR_LIMIT</span><span class="ActionScriptBracket/Brace">)</span>;
                <span class="ActionScriptBracket/Brace">}</span>
                <span class="ActionScriptDefault_Text">lc</span>.<span class="ActionScriptDefault_Text">send</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">loggerConnectionName</span> <span class="ActionScriptOperator">+</span> <span class="ActionScriptDefault_Text">channel</span>, <span class="ActionScriptString">&quot;$progress&quot;</span>, <span class="ActionScriptString">&quot;COMPLETE_STATUS&quot;</span><span class="ActionScriptBracket/Brace">)</span>;
            <span class="ActionScriptBracket/Brace">}</span>;
            <span class="ActionScriptDefault_Text">lc</span>.<span class="ActionScriptDefault_Text">client</span>.<span class="ActionScriptDefault_Text">$progress</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptfunction">function</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">status</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span>, <span class="ActionScriptDefault_Text">substring</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span><span class="ActionScriptOperator">=</span><span class="ActionScriptReserved">null</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span> <span class="ActionScriptBracket/Brace">{</span>
                <span class="ActionScriptReserved">if</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">status</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptString">&quot;INIT_STATUS&quot;</span><span class="ActionScriptBracket/Brace">){</span>
                    <span class="ActionScriptDefault_Text">message</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptString">&quot;&quot;</span>;
                <span class="ActionScriptBracket/Brace">}</span><span class="ActionScriptReserved">else</span> <span class="ActionScriptReserved">if</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">status</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptString">&quot;COMPLETE_STATUS&quot;</span><span class="ActionScriptBracket/Brace">){</span>
                    <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">parameters</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Array</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">message</span>.<span class="ActionScriptDefault_Text">split</span><span class="ActionScriptBracket/Brace">(A</span><span class="ActionScriptDefault_Text">RRAY_DELIMITER</span><span class="ActionScriptBracket/Brace">)</span>;
                    <span class="ActionScriptDefault_Text">lc</span>.<span class="ActionScriptDefault_Text">client</span>.<span class="ActionScriptDefault_Text">$result</span>.<span class="ActionScriptDefault_Text">apply</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptReserved">null</span>, <span class="ActionScriptDefault_Text">parameters</span><span class="ActionScriptBracket/Brace">)</span>;
                <span class="ActionScriptBracket/Brace">}</span><span class="ActionScriptReserved">else</span> <span class="ActionScriptReserved">if</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">status</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptString">&quot;SENDING_STATUS&quot;</span><span class="ActionScriptBracket/Brace">){</span>
                    <span class="ActionScriptDefault_Text">message</span> <span class="ActionScriptOperator">+=</span> <span class="ActionScriptDefault_Text">substring</span>;
                <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptBracket/Brace">}</span>;
            <span class="ActionScriptDefault_Text">lc</span>.<span class="ActionScriptDefault_Text">client</span>.<span class="ActionScriptDefault_Text">$terminate</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptfunction">function</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">channel</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">int</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span><span class="ActionScriptBracket/Brace">{</span>
                <span class="ActionScriptReserved">try</span><span class="ActionScriptBracket/Brace">{</span>
                    <span class="ActionScriptDefault_Text">lc</span>.<span class="ActionScriptDefault_Text">close</span><span class="ActionScriptBracket/Brace">()</span>;
                    <span class="ActionScriptReserved">if</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">lc</span>.<span class="ActionScriptDefault_Text">client</span>.<span class="ActionScriptDefault_Text">$status</span> <span class="ActionScriptReserved">is</span> <span class="ActionScriptDefault_Text">Function</span><span class="ActionScriptBracket/Brace">)</span>
                        <span class="ActionScriptDefault_Text">lc</span>.<span class="ActionScriptDefault_Text">client</span>.<span class="ActionScriptDefault_Text">$status</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">channel</span>, <span class="ActionScriptString">&quot;terminate&quot;</span>, <span class="ActionScriptString">&quot;Connection terminated: Connection name is already being used by another SWF&quot;</span><span class="ActionScriptBracket/Brace">)</span>;
                <span class="ActionScriptBracket/Brace">}</span><span class="ActionScriptReserved">catch</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">error</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Error</span><span class="ActionScriptBracket/Brace">){</span><span class="ActionScripttrace">trace</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">error</span><span class="ActionScriptBracket/Brace">)}</span>
            <span class="ActionScriptBracket/Brace">}</span>;
        
            <span class="ActionScriptReserved">if</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">resultHandler</span> <span class="ActionScriptOperator">!=</span> <span class="ActionScriptReserved">null</span><span class="ActionScriptBracket/Brace">){</span> 
                <span class="ActionScriptReserved">try</span><span class="ActionScriptBracket/Brace">{</span>
                    <span class="ActionScriptDefault_Text">clearInterval</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">_connectionInterval</span><span class="ActionScriptBracket/Brace">)</span>;
                    <span class="ActionScriptDefault_Text">lc</span>.<span class="ActionScriptDefault_Text">connect</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">loggerConnectionName</span> <span class="ActionScriptOperator">+</span> <span class="ActionScriptDefault_Text">channel</span><span class="ActionScriptBracket/Brace">)</span>;
                    <span class="ActionScriptReserved">if</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">lc</span>.<span class="ActionScriptDefault_Text">client</span>.<span class="ActionScriptDefault_Text">$status</span> <span class="ActionScriptReserved">is</span> <span class="ActionScriptDefault_Text">Function</span><span class="ActionScriptBracket/Brace">)</span>
                        <span class="ActionScriptDefault_Text">lc</span>.<span class="ActionScriptDefault_Text">client</span>.<span class="ActionScriptDefault_Text">$status</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">channel</span>, <span class="ActionScriptString">&quot;ready&quot;</span>, <span class="ActionScriptString">&quot;Connection opened.&quot;</span><span class="ActionScriptBracket/Brace">)</span>;
                    <span class="ActionScriptDefault_Text">_localConnectionClient</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">lc</span>.<span class="ActionScriptDefault_Text">client</span>;
                <span class="ActionScriptBracket/Brace">}</span> <span class="ActionScriptReserved">catch</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">error</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">ArgumentError</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptBracket/Brace">{</span>
                    <span class="ActionScriptDefault_Text">lc</span>.<span class="ActionScriptDefault_Text">send</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">loggerConnectionName</span> <span class="ActionScriptOperator">+</span> <span class="ActionScriptDefault_Text">channel</span>, <span class="ActionScriptString">&quot;$terminate&quot;</span>, <span class="ActionScriptDefault_Text">channel</span><span class="ActionScriptBracket/Brace">)</span>;
                    <span class="ActionScriptDefault_Text">_connectionInterval</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">setInterval</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">_connect</span>, 500, <span class="ActionScriptDefault_Text">channel</span>, <span class="ActionScriptDefault_Text">resultHandler</span>, <span class="ActionScriptDefault_Text">statusHandler</span><span class="ActionScriptBracket/Brace">)</span>;
                <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptReserved">return</span> <span class="ActionScriptDefault_Text">lc</span>;
        <span class="ActionScriptBracket/Brace">}</span>
        
        <span class="ActionScriptComment">//Utils
</span>        <span class="ActionScriptReserved">private</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">refCount</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">int</span> <span class="ActionScriptOperator">=</span> 0;
        
        <span class="ActionScriptReserved">private</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">formatDate</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">date</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Date</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span><span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptReserved">return</span> <span class="ActionScriptDefault_Text">date</span>.<span class="ActionScriptDefault_Text">hours</span> <span class="ActionScriptOperator">+</span> <span class="ActionScriptString">&apos;-&apos;</span> <span class="ActionScriptOperator">+</span> <span class="ActionScriptDefault_Text">date</span>.<span class="ActionScriptDefault_Text">minutes</span> <span class="ActionScriptOperator">+</span> <span class="ActionScriptString">&apos;-&apos;</span> <span class="ActionScriptOperator">+</span> <span class="ActionScriptDefault_Text">date</span>.<span class="ActionScriptDefault_Text">seconds</span>;
        <span class="ActionScriptBracket/Brace">}</span>
        
        <span class="ActionScriptReserved">private</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">toString</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">value</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Object</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span><span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptDefault_Text">refCount</span> <span class="ActionScriptOperator">=</span> 0;
            <span class="ActionScriptReserved">return</span> <span class="ActionScriptDefault_Text">internalToString</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">value</span><span class="ActionScriptBracket/Brace">)</span>;
        <span class="ActionScriptBracket/Brace">}</span>
        
        <span class="ActionScriptReserved">private</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">internalToString</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">value</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Object</span>, 
                                             <span class="ActionScriptDefault_Text">indent</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">int</span> <span class="ActionScriptOperator">=</span> 0,
                                             <span class="ActionScriptDefault_Text">refs</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Object</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">null</span>, 
                                             <span class="ActionScriptDefault_Text">namespaceURIs</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Array</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">null</span>, 
                                             <span class="ActionScriptDefault_Text">exclude</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Array</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">null</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span><span class="ActionScriptBracket/Brace">{</span>
                                             
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">type</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">value</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptReserved">null</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptOperator">?</span> <span class="ActionScriptString">&quot;null&quot;</span> <span class="ActionScriptOperator">:</span> <span class="ActionScriptReserved">typeof</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">value</span><span class="ActionScriptBracket/Brace">)</span>;
            <span class="ActionScriptReserved">if</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">type</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptString">&quot;xml&quot;</span><span class="ActionScriptBracket/Brace">){</span>
                <span class="ActionScriptReserved">return</span> <span class="ActionScriptDefault_Text">value</span>.<span class="ActionScriptDefault_Text">toXMLString</span><span class="ActionScriptBracket/Brace">()</span>;
            <span class="ActionScriptBracket/Brace">}</span><span class="ActionScriptReserved">else</span> <span class="ActionScriptReserved">if</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">type</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptString">&quot;object&quot;</span><span class="ActionScriptBracket/Brace">){</span>
                <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">value</span> <span class="ActionScriptReserved">is</span> <span class="ActionScriptDefault_Text">Date</span><span class="ActionScriptBracket/Brace">)</span>
                    <span class="ActionScriptReserved">return</span> <span class="ActionScriptDefault_Text">value</span>.<span class="ActionScriptDefault_Text">toString</span><span class="ActionScriptBracket/Brace">()</span>;
                <span class="ActionScriptReserved">else</span> <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">value</span> <span class="ActionScriptReserved">is</span> <span class="ActionScriptDefault_Text">XMLNode</span><span class="ActionScriptBracket/Brace">)</span>
                    <span class="ActionScriptReserved">return</span> <span class="ActionScriptDefault_Text">value</span>.<span class="ActionScriptDefault_Text">toString</span><span class="ActionScriptBracket/Brace">()</span>;
                <span class="ActionScriptReserved">else</span> <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">value</span> <span class="ActionScriptReserved">is</span> <span class="ActionScriptDefault_Text">Class</span><span class="ActionScriptBracket/Brace">)</span>
                    <span class="ActionScriptReserved">return</span> <span class="ActionScriptString">&quot;(&quot;</span> <span class="ActionScriptOperator">+</span> <span class="ActionScriptDefault_Text">getQualifiedClassName</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">value</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptOperator">+</span> <span class="ActionScriptString">&quot;)&quot;</span>;
                <span class="ActionScriptReserved">else</span><span class="ActionScriptBracket/Brace">{</span>
                    <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">str</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span>;
                    <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">classInfo</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Object</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">getClassInfo</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">value</span>, <span class="ActionScriptDefault_Text">exclude</span>,
                        <span class="ActionScriptBracket/Brace">{</span> <span class="ActionScriptDefault_Text">includeReadOnly</span><span class="ActionScriptOperator">:</span> <span class="ActionScriptReserved">true</span>, <span class="ActionScriptDefault_Text">uris</span><span class="ActionScriptOperator">:</span> <span class="ActionScriptDefault_Text">namespaceURIs</span> <span class="ActionScriptBracket/Brace">})</span>;
                        
                    <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">properties</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Array</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">classInfo</span>.<span class="ActionScriptDefault_Text">properties</span>;
                    
                    <span class="ActionScriptDefault_Text">str</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptString">&quot;(&quot;</span> <span class="ActionScriptOperator">+</span> <span class="ActionScriptDefault_Text">classInfo</span>.<span class="ActionScriptDefault_Text">name</span> <span class="ActionScriptOperator">+</span> <span class="ActionScriptString">&quot;)&quot;</span>;
                    
                    <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">refs</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptReserved">null</span><span class="ActionScriptBracket/Brace">)</span>
                        <span class="ActionScriptDefault_Text">refs</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">Object</span><span class="ActionScriptBracket/Brace">()</span>;

                    <span class="ActionScriptComment">// Check to be sure we haven&apos;t processed this object before
</span>                    <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">id</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Object</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">refs</span><span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptDefault_Text">value</span><span class="ActionScriptBracket/Brace">]</span>;
                    <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">id</span> <span class="ActionScriptOperator">!=</span> <span class="ActionScriptReserved">null</span><span class="ActionScriptBracket/Brace">){</span>
                        <span class="ActionScriptDefault_Text">str</span> <span class="ActionScriptOperator">+=</span> <span class="ActionScriptString">&quot;#&quot;</span> <span class="ActionScriptOperator">+</span> <span class="ActionScriptDefault_Text">int</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">id</span><span class="ActionScriptBracket/Brace">)</span>;
                        <span class="ActionScriptReserved">return</span> <span class="ActionScriptDefault_Text">str</span>;
                    <span class="ActionScriptBracket/Brace">}</span>
                    
                    <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">value</span> <span class="ActionScriptOperator">!=</span> <span class="ActionScriptReserved">null</span><span class="ActionScriptBracket/Brace">){</span>
                        <span class="ActionScriptDefault_Text">str</span> <span class="ActionScriptOperator">+=</span> <span class="ActionScriptString">&quot;#&quot;</span> <span class="ActionScriptOperator">+</span> <span class="ActionScriptDefault_Text">refCount</span>.<span class="ActionScriptDefault_Text">toString</span><span class="ActionScriptBracket/Brace">()</span>;
                        <span class="ActionScriptDefault_Text">refs</span><span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptDefault_Text">value</span><span class="ActionScriptBracket/Brace">]</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">refCount</span>;
                        <span class="ActionScriptDefault_Text">refCount</span><span class="ActionScriptOperator">++</span>;
                    <span class="ActionScriptBracket/Brace">}</span>

                    <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">isArray</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Boolean</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">value</span> <span class="ActionScriptReserved">is</span> <span class="ActionScriptDefault_Text">Array</span>;
                    <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">isDict</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Boolean</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">classInfo</span>.<span class="ActionScriptDefault_Text">name</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptString">&quot;flash.utils::Dictionary&quot;</span><span class="ActionScriptBracket/Brace">)</span>;
                    <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">prop</span><span class="ActionScriptOperator">:*</span>;
                    <span class="ActionScriptDefault_Text">indent</span> <span class="ActionScriptOperator">+=</span> 2;
                    
                    <span class="ActionScriptComment">// Print all of the variable values.
</span>                    <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">array</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Array</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptDefault_Text">str</span><span class="ActionScriptBracket/Brace">]</span>;
                    <span class="ActionScriptReserved">for</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">j</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">int</span> <span class="ActionScriptOperator">=</span> 0; <span class="ActionScriptDefault_Text">j</span> <span class="ActionScriptOperator">&lt;</span> <span class="ActionScriptDefault_Text">properties</span>.<span class="ActionScriptDefault_Text">length</span>; <span class="ActionScriptDefault_Text">j</span><span class="ActionScriptOperator">++</span><span class="ActionScriptBracket/Brace">){</span>
                        <span class="ActionScriptDefault_Text">str</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptString">&quot;&quot;</span>;
                        <span class="ActionScriptDefault_Text">prop</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">properties</span><span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptDefault_Text">j</span><span class="ActionScriptBracket/Brace">]</span>;
                        
                        <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">isArray</span><span class="ActionScriptBracket/Brace">)</span>
                            <span class="ActionScriptDefault_Text">str</span> <span class="ActionScriptOperator">+=</span> <span class="ActionScriptString">&quot;[&quot;</span>;
                        <span class="ActionScriptReserved">else</span> <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">isDict</span><span class="ActionScriptBracket/Brace">)</span>
                            <span class="ActionScriptDefault_Text">str</span> <span class="ActionScriptOperator">+=</span> <span class="ActionScriptString">&quot;{&quot;</span>;

                    
                        <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">isDict</span><span class="ActionScriptBracket/Brace">){</span>
                            <span class="ActionScriptComment">// in dictionaries, recurse on the key, because it can be a complex object
</span>                            <span class="ActionScriptDefault_Text">str</span> <span class="ActionScriptOperator">+=</span> <span class="ActionScriptDefault_Text">internalToString</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">prop</span>, <span class="ActionScriptDefault_Text">indent</span>, <span class="ActionScriptDefault_Text">refs</span>,
                                                    <span class="ActionScriptDefault_Text">namespaceURIs</span>, <span class="ActionScriptDefault_Text">exclude</span><span class="ActionScriptBracket/Brace">)</span>;
                        <span class="ActionScriptBracket/Brace">}</span><span class="ActionScriptReserved">else</span><span class="ActionScriptBracket/Brace">{</span>
                            <span class="ActionScriptDefault_Text">str</span> <span class="ActionScriptOperator">+=</span> <span class="ActionScriptDefault_Text">prop</span>.<span class="ActionScriptDefault_Text">toString</span><span class="ActionScriptBracket/Brace">()</span>;
                        <span class="ActionScriptBracket/Brace">}</span>
                        
                        <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">isArray</span><span class="ActionScriptBracket/Brace">)</span>
                            <span class="ActionScriptDefault_Text">str</span> <span class="ActionScriptOperator">+=</span> <span class="ActionScriptString">&quot;] &quot;</span>;
                        <span class="ActionScriptReserved">else</span> <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">isDict</span><span class="ActionScriptBracket/Brace">)</span>
                            <span class="ActionScriptDefault_Text">str</span> <span class="ActionScriptOperator">+=</span> <span class="ActionScriptString">&quot;} = &quot;</span>;
                        <span class="ActionScriptReserved">else</span>
                            <span class="ActionScriptDefault_Text">str</span> <span class="ActionScriptOperator">+=</span> <span class="ActionScriptString">&quot; = &quot;</span>;
                        
                        <span class="ActionScriptReserved">try</span><span class="ActionScriptBracket/Brace">{</span>
                            <span class="ActionScriptComment">// print the value
</span>                            <span class="ActionScriptDefault_Text">str</span> <span class="ActionScriptOperator">+=</span> <span class="ActionScriptDefault_Text">internalToString</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">value</span><span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptDefault_Text">prop</span><span class="ActionScriptBracket/Brace">]</span>, <span class="ActionScriptDefault_Text">indent</span>, <span class="ActionScriptDefault_Text">refs</span>,
                                                    <span class="ActionScriptDefault_Text">namespaceURIs</span>, <span class="ActionScriptDefault_Text">exclude</span><span class="ActionScriptBracket/Brace">)</span>;
                        <span class="ActionScriptBracket/Brace">}</span><span class="ActionScriptReserved">catch</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">e</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Error</span><span class="ActionScriptBracket/Brace">){</span>
                            <span class="ActionScriptDefault_Text">str</span> <span class="ActionScriptOperator">+=</span> <span class="ActionScriptString">&quot;?&quot;</span>;
                        <span class="ActionScriptBracket/Brace">}</span>
                        <span class="ActionScriptDefault_Text">array</span>.<span class="ActionScriptDefault_Text">push</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">str</span><span class="ActionScriptBracket/Brace">)</span>;
                    <span class="ActionScriptBracket/Brace">}</span>
                    <span class="ActionScriptDefault_Text">indent</span> <span class="ActionScriptOperator">-=</span> 2;
                    <span class="ActionScriptReserved">return</span> <span class="ActionScriptDefault_Text">array</span>.<span class="ActionScriptDefault_Text">join</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">&apos;\n&apos;</span><span class="ActionScriptBracket/Brace">)</span>;
                <span class="ActionScriptBracket/Brace">}</span>
                <span class="ActionScriptReserved">return</span> <span class="ActionScriptDefault_Text">value</span>;
            <span class="ActionScriptBracket/Brace">}</span><span class="ActionScriptReserved">else</span><span class="ActionScriptBracket/Brace">{</span>
                <span class="ActionScriptReserved">return</span> <span class="ActionScriptDefault_Text">String</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">value</span><span class="ActionScriptBracket/Brace">)</span>;
            <span class="ActionScriptBracket/Brace">}</span>
        <span class="ActionScriptBracket/Brace">}</span>
        
        <span class="ActionScriptReserved">private</span> <span class="ActionScriptReserved">static</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">getClassInfo</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">obj</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Object</span>,
                                        <span class="ActionScriptDefault_Text">excludes</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Array</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">null</span>,
                                        <span class="ActionScriptDefault_Text">options</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Object</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">null</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Object</span>
        <span class="ActionScriptBracket/Brace">{</span>   
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">n</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">int</span>;
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">i</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">int</span>;
    
            <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">options</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptReserved">null</span><span class="ActionScriptBracket/Brace">)</span>
                <span class="ActionScriptDefault_Text">options</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptBracket/Brace">{</span> <span class="ActionScriptDefault_Text">includeReadOnly</span><span class="ActionScriptOperator">:</span> <span class="ActionScriptReserved">true</span>, <span class="ActionScriptDefault_Text">uris</span><span class="ActionScriptOperator">:</span> <span class="ActionScriptReserved">null</span>, <span class="ActionScriptDefault_Text">includeTransient</span><span class="ActionScriptOperator">:</span> <span class="ActionScriptReserved">true</span> <span class="ActionScriptBracket/Brace">}</span>;
    
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">result</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Object</span>;
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">propertyNames</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Array</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptBracket/Brace">[]</span>;
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">cacheKey</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span>;
    
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">className</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span>;
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">classAlias</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span>;
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">properties</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">XMLList</span>;
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">prop</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">XML</span>;
            <span class="ActionScriptvar">var</span> <span class="ActionScriptReserved">dynamic</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Boolean</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">false</span>;
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">metadataInfo</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Object</span>;
    
            <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptReserved">typeof</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">obj</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptString">&quot;xml&quot;</span><span class="ActionScriptBracket/Brace">){</span>
                <span class="ActionScriptDefault_Text">className</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptString">&quot;XML&quot;</span>;
                <span class="ActionScriptDefault_Text">properties</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">obj</span>.<span class="ActionScriptDefault_Text">text</span><span class="ActionScriptBracket/Brace">()</span>;
                <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">properties</span>.<span class="ActionScriptDefault_Text">length</span><span class="ActionScriptBracket/Brace">())</span>
                    <span class="ActionScriptDefault_Text">propertyNames</span>.<span class="ActionScriptDefault_Text">push</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">&quot;*&quot;</span><span class="ActionScriptBracket/Brace">)</span>;
                <span class="ActionScriptDefault_Text">properties</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">obj</span>.<span class="ActionScriptDefault_Text">attributes</span><span class="ActionScriptBracket/Brace">()</span>;
            <span class="ActionScriptBracket/Brace">}</span><span class="ActionScriptReserved">else</span><span class="ActionScriptBracket/Brace">{</span>
                <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">classInfo</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">XML</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">describeType</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">obj</span><span class="ActionScriptBracket/Brace">)</span>;
                <span class="ActionScriptDefault_Text">className</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">classInfo</span>.@<span class="ActionScriptDefault_Text">name</span>.<span class="ActionScriptDefault_Text">toString</span><span class="ActionScriptBracket/Brace">()</span>;
                <span class="ActionScriptDefault_Text">classAlias</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">classInfo</span>.@<span class="ActionScriptDefault_Text">alias</span>.<span class="ActionScriptDefault_Text">toString</span><span class="ActionScriptBracket/Brace">()</span>;
                <span class="ActionScriptReserved">dynamic</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">classInfo</span>.@<span class="ActionScriptDefault_Text">isDynamic</span>.<span class="ActionScriptDefault_Text">toString</span><span class="ActionScriptBracket/Brace">()</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptString">&quot;true&quot;</span><span class="ActionScriptBracket/Brace">)</span>;
    
                <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">options</span>.<span class="ActionScriptDefault_Text">includeReadOnly</span><span class="ActionScriptBracket/Brace">)</span>
                    <span class="ActionScriptDefault_Text">properties</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">classInfo</span>..<span class="ActionScriptDefault_Text">accessor</span>.<span class="ActionScriptBracket/Brace">(</span>@<span class="ActionScriptDefault_Text">access</span> <span class="ActionScriptOperator">!=</span> <span class="ActionScriptString">&quot;writeonly&quot;</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptOperator">+</span> <span class="ActionScriptDefault_Text">classInfo</span>..<span class="ActionScriptDefault_Text">variable</span>;
                <span class="ActionScriptReserved">else</span>
                    <span class="ActionScriptDefault_Text">properties</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">classInfo</span>..<span class="ActionScriptDefault_Text">accessor</span>.<span class="ActionScriptBracket/Brace">(</span>@<span class="ActionScriptDefault_Text">access</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptString">&quot;readwrite&quot;</span><span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptOperator">+</span> <span class="ActionScriptDefault_Text">classInfo</span>..<span class="ActionScriptDefault_Text">variable</span>;
    
                <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">numericIndex</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Boolean</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">false</span>;
            <span class="ActionScriptBracket/Brace">}</span>
        
            <span class="ActionScriptDefault_Text">result</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptBracket/Brace">{}</span>;
            <span class="ActionScriptDefault_Text">result</span><span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptString">&quot;name&quot;</span><span class="ActionScriptBracket/Brace">]</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">className</span>;
            <span class="ActionScriptDefault_Text">result</span><span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptString">&quot;alias&quot;</span><span class="ActionScriptBracket/Brace">]</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">classAlias</span>;
            <span class="ActionScriptDefault_Text">result</span><span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptString">&quot;properties&quot;</span><span class="ActionScriptBracket/Brace">]</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">propertyNames</span>;
            <span class="ActionScriptDefault_Text">result</span><span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptString">&quot;dynamic&quot;</span><span class="ActionScriptBracket/Brace">]</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">dynamic</span>;
                        
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">excludeObject</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Object</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptBracket/Brace">{}</span>;
            <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">excludes</span><span class="ActionScriptBracket/Brace">){</span>
                <span class="ActionScriptDefault_Text">n</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">excludes</span>.<span class="ActionScriptDefault_Text">length</span>;
                <span class="ActionScriptReserved">for</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">i</span> <span class="ActionScriptOperator">=</span> 0; <span class="ActionScriptDefault_Text">i</span> <span class="ActionScriptOperator">&lt;</span> <span class="ActionScriptDefault_Text">n</span>; <span class="ActionScriptDefault_Text">i</span><span class="ActionScriptOperator">++</span><span class="ActionScriptBracket/Brace">)</span>
                    <span class="ActionScriptDefault_Text">excludeObject</span><span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptDefault_Text">excludes</span><span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptDefault_Text">i</span><span class="ActionScriptBracket/Brace">]]</span> <span class="ActionScriptOperator">=</span> 1;
            <span class="ActionScriptBracket/Brace">}</span>
    
            <span class="ActionScriptComment">//TODO this seems slightly fragile, why not use the &apos;is&apos; operator?
</span>            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">isArray</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Boolean</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">className</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptString">&quot;Array&quot;</span><span class="ActionScriptBracket/Brace">)</span>;
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">isDict</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Boolean</span>  <span class="ActionScriptOperator">=</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">className</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptString">&quot;flash.utils::Dictionary&quot;</span><span class="ActionScriptBracket/Brace">)</span>;
            
            <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">isDict</span><span class="ActionScriptBracket/Brace">){</span>
                <span class="ActionScriptComment">// dictionaries can have multiple keys of the same type,
</span>                <span class="ActionScriptComment">// (they can index by reference rather than QName, String, or number),
</span>                <span class="ActionScriptComment">// which cannot be looked up by QName, so use references to the actual key
</span>                <span class="ActionScriptReserved">for</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">key</span><span class="ActionScriptOperator">:*</span> <span class="ActionScriptReserved">in</span> <span class="ActionScriptDefault_Text">obj</span><span class="ActionScriptBracket/Brace">)</span>
                    <span class="ActionScriptDefault_Text">propertyNames</span>.<span class="ActionScriptDefault_Text">push</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">key</span><span class="ActionScriptBracket/Brace">)</span>;
            <span class="ActionScriptBracket/Brace">}</span><span class="ActionScriptReserved">else</span> <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptReserved">dynamic</span><span class="ActionScriptBracket/Brace">){</span>
                <span class="ActionScriptReserved">for</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">p</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span> <span class="ActionScriptReserved">in</span> <span class="ActionScriptDefault_Text">obj</span><span class="ActionScriptBracket/Brace">)</span>
                <span class="ActionScriptBracket/Brace">{</span>
                    <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">excludeObject</span><span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptDefault_Text">p</span><span class="ActionScriptBracket/Brace">]</span> <span class="ActionScriptOperator">!=</span> 1<span class="ActionScriptBracket/Brace">)</span>
                    <span class="ActionScriptBracket/Brace">{</span>
                        <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">isArray</span><span class="ActionScriptBracket/Brace">)</span>
                        <span class="ActionScriptBracket/Brace">{</span>
                             <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">pi</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Number</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">parseInt</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p</span><span class="ActionScriptBracket/Brace">)</span>;
                             <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">isNaN</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">pi</span><span class="ActionScriptBracket/Brace">))</span>
                                <span class="ActionScriptDefault_Text">propertyNames</span>.<span class="ActionScriptDefault_Text">push</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">QName</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">&quot;&quot;</span>, <span class="ActionScriptDefault_Text">p</span><span class="ActionScriptBracket/Brace">))</span>;
                             <span class="ActionScriptReserved">else</span>
                                <span class="ActionScriptDefault_Text">propertyNames</span>.<span class="ActionScriptDefault_Text">push</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">pi</span><span class="ActionScriptBracket/Brace">)</span>;
                        <span class="ActionScriptBracket/Brace">}</span>
                        <span class="ActionScriptReserved">else</span>
                        <span class="ActionScriptBracket/Brace">{</span>
                            <span class="ActionScriptDefault_Text">propertyNames</span>.<span class="ActionScriptDefault_Text">push</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">QName</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">&quot;&quot;</span>, <span class="ActionScriptDefault_Text">p</span><span class="ActionScriptBracket/Brace">))</span>;
                        <span class="ActionScriptBracket/Brace">}</span>
                    <span class="ActionScriptBracket/Brace">}</span>
                <span class="ActionScriptBracket/Brace">}</span>
                <span class="ActionScriptDefault_Text">numericIndex</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">isArray</span> <span class="ActionScriptOperator">&amp;&amp;</span> <span class="ActionScriptOperator">!</span><span class="ActionScriptDefault_Text">isNaN</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">Number</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">p</span><span class="ActionScriptBracket/Brace">))</span>;
            <span class="ActionScriptBracket/Brace">}</span>
    
            <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">isArray</span> <span class="ActionScriptOperator">||</span> <span class="ActionScriptDefault_Text">isDict</span> <span class="ActionScriptOperator">||</span> <span class="ActionScriptDefault_Text">className</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptString">&quot;Object&quot;</span><span class="ActionScriptBracket/Brace">){</span>
                <span class="ActionScriptComment">// Do nothing since we&apos;ve already got the dynamic members
</span>            <span class="ActionScriptBracket/Brace">}</span><span class="ActionScriptReserved">else</span> <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">className</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptString">&quot;XML&quot;</span><span class="ActionScriptBracket/Brace">){</span>
                <span class="ActionScriptDefault_Text">n</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">properties</span>.<span class="ActionScriptDefault_Text">length</span><span class="ActionScriptBracket/Brace">()</span>;
                <span class="ActionScriptReserved">for</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">i</span> <span class="ActionScriptOperator">=</span> 0; <span class="ActionScriptDefault_Text">i</span> <span class="ActionScriptOperator">&lt;</span> <span class="ActionScriptDefault_Text">n</span>; <span class="ActionScriptDefault_Text">i</span><span class="ActionScriptOperator">++</span><span class="ActionScriptBracket/Brace">){</span>
                    <span class="ActionScriptDefault_Text">p</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">properties</span><span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptDefault_Text">i</span><span class="ActionScriptBracket/Brace">]</span>.<span class="ActionScriptDefault_Text">name</span><span class="ActionScriptBracket/Brace">()</span>;
                    <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">excludeObject</span><span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptDefault_Text">p</span><span class="ActionScriptBracket/Brace">]</span> <span class="ActionScriptOperator">!=</span> 1<span class="ActionScriptBracket/Brace">)</span>
                        <span class="ActionScriptDefault_Text">propertyNames</span>.<span class="ActionScriptDefault_Text">push</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">QName</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">&quot;&quot;</span>, <span class="ActionScriptString">&quot;@&quot;</span> <span class="ActionScriptOperator">+</span> <span class="ActionScriptDefault_Text">p</span><span class="ActionScriptBracket/Brace">))</span>;
                <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptBracket/Brace">}</span><span class="ActionScriptReserved">else</span><span class="ActionScriptBracket/Brace">{</span>
                <span class="ActionScriptDefault_Text">n</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">properties</span>.<span class="ActionScriptDefault_Text">length</span><span class="ActionScriptBracket/Brace">()</span>;
                <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">uris</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Array</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">options</span>.<span class="ActionScriptDefault_Text">uris</span>;
                <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">uri</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span>;
                <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">qName</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">QName</span>;
                <span class="ActionScriptReserved">for</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">i</span> <span class="ActionScriptOperator">=</span> 0; <span class="ActionScriptDefault_Text">i</span> <span class="ActionScriptOperator">&lt;</span> <span class="ActionScriptDefault_Text">n</span>; <span class="ActionScriptDefault_Text">i</span><span class="ActionScriptOperator">++</span><span class="ActionScriptBracket/Brace">)</span>
                <span class="ActionScriptBracket/Brace">{</span>
                    <span class="ActionScriptDefault_Text">prop</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">properties</span><span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptDefault_Text">i</span><span class="ActionScriptBracket/Brace">]</span>;
                    <span class="ActionScriptDefault_Text">p</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">prop</span>.@<span class="ActionScriptDefault_Text">name</span>.<span class="ActionScriptDefault_Text">toString</span><span class="ActionScriptBracket/Brace">()</span>;
                    <span class="ActionScriptDefault_Text">uri</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">prop</span>.@<span class="ActionScriptDefault_Text">uri</span>.<span class="ActionScriptDefault_Text">toString</span><span class="ActionScriptBracket/Brace">()</span>;
                    
                    <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">excludeObject</span><span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptDefault_Text">p</span><span class="ActionScriptBracket/Brace">]</span> <span class="ActionScriptOperator">==</span> 1<span class="ActionScriptBracket/Brace">)</span>
                        <span class="ActionScriptReserved">continue</span>;
                        
                    <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(!</span><span class="ActionScriptDefault_Text">options</span>.<span class="ActionScriptDefault_Text">includeTransient</span><span class="ActionScriptBracket/Brace">)</span>
                        <span class="ActionScriptReserved">continue</span>;
                    
                    <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">uris</span> <span class="ActionScriptOperator">!=</span> <span class="ActionScriptReserved">null</span><span class="ActionScriptBracket/Brace">){</span>
                        <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">uris</span>.<span class="ActionScriptDefault_Text">length</span> <span class="ActionScriptOperator">==</span> 1 <span class="ActionScriptOperator">&amp;&amp;</span> <span class="ActionScriptDefault_Text">uris</span><span class="ActionScriptBracket/Brace">[</span>0<span class="ActionScriptBracket/Brace">]</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptString">&quot;*&quot;</span><span class="ActionScriptBracket/Brace">){</span>   
                            <span class="ActionScriptDefault_Text">qName</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">QName</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">uri</span>, <span class="ActionScriptDefault_Text">p</span><span class="ActionScriptBracket/Brace">)</span>;
                            <span class="ActionScriptReserved">try</span><span class="ActionScriptBracket/Brace">{</span>
                                <span class="ActionScriptDefault_Text">obj</span><span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptDefault_Text">qName</span><span class="ActionScriptBracket/Brace">]</span>; <span class="ActionScriptComment">// access the property to ensure it is supported
</span>                                <span class="ActionScriptDefault_Text">propertyNames</span>.<span class="ActionScriptDefault_Text">push</span><span class="ActionScriptBracket/Brace">()</span>;
                            <span class="ActionScriptBracket/Brace">}</span><span class="ActionScriptReserved">catch</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">e</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Error</span><span class="ActionScriptBracket/Brace">){</span>
                                <span class="ActionScriptComment">// don&apos;t keep property name 
</span>                            <span class="ActionScriptBracket/Brace">}</span>
                        <span class="ActionScriptBracket/Brace">}</span><span class="ActionScriptReserved">else</span><span class="ActionScriptBracket/Brace">{</span>
                            <span class="ActionScriptReserved">for</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">j</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">int</span> <span class="ActionScriptOperator">=</span> 0; <span class="ActionScriptDefault_Text">j</span> <span class="ActionScriptOperator">&lt;</span> <span class="ActionScriptDefault_Text">uris</span>.<span class="ActionScriptDefault_Text">length</span>; <span class="ActionScriptDefault_Text">j</span><span class="ActionScriptOperator">++</span><span class="ActionScriptBracket/Brace">){</span>
                                <span class="ActionScriptDefault_Text">uri</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">uris</span><span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptDefault_Text">j</span><span class="ActionScriptBracket/Brace">]</span>;
                                <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">prop</span>.@<span class="ActionScriptDefault_Text">uri</span>.<span class="ActionScriptDefault_Text">toString</span><span class="ActionScriptBracket/Brace">()</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptDefault_Text">uri</span><span class="ActionScriptBracket/Brace">){</span>
                                    <span class="ActionScriptDefault_Text">qName</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">QName</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">uri</span>, <span class="ActionScriptDefault_Text">p</span><span class="ActionScriptBracket/Brace">)</span>;
                                    <span class="ActionScriptReserved">try</span><span class="ActionScriptBracket/Brace">{</span>
                                        <span class="ActionScriptDefault_Text">obj</span><span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptDefault_Text">qName</span><span class="ActionScriptBracket/Brace">]</span>;
                                        <span class="ActionScriptDefault_Text">propertyNames</span>.<span class="ActionScriptDefault_Text">push</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">qName</span><span class="ActionScriptBracket/Brace">)</span>;
                                    <span class="ActionScriptBracket/Brace">}</span><span class="ActionScriptReserved">catch</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">e</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Error</span><span class="ActionScriptBracket/Brace">){</span>
                                        <span class="ActionScriptComment">// don&apos;t keep property name 
</span>                                    <span class="ActionScriptBracket/Brace">}</span>
                                <span class="ActionScriptBracket/Brace">}</span>
                            <span class="ActionScriptBracket/Brace">}</span>
                        <span class="ActionScriptBracket/Brace">}</span>
                    <span class="ActionScriptBracket/Brace">}</span>
                    <span class="ActionScriptReserved">else</span> <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">uri</span>.<span class="ActionScriptDefault_Text">length</span> <span class="ActionScriptOperator">==</span> 0<span class="ActionScriptBracket/Brace">)</span>
                    <span class="ActionScriptBracket/Brace">{</span>
                        <span class="ActionScriptDefault_Text">qName</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">QName</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">uri</span>, <span class="ActionScriptDefault_Text">p</span><span class="ActionScriptBracket/Brace">)</span>;
                        <span class="ActionScriptReserved">try</span><span class="ActionScriptBracket/Brace">{</span>
                            <span class="ActionScriptDefault_Text">obj</span><span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptDefault_Text">qName</span><span class="ActionScriptBracket/Brace">]</span>;
                            <span class="ActionScriptDefault_Text">propertyNames</span>.<span class="ActionScriptDefault_Text">push</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">qName</span><span class="ActionScriptBracket/Brace">)</span>;
                        <span class="ActionScriptBracket/Brace">}</span><span class="ActionScriptReserved">catch</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">e</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Error</span><span class="ActionScriptBracket/Brace">){</span>
                            <span class="ActionScriptComment">// don&apos;t keep property name 
</span>                        <span class="ActionScriptBracket/Brace">}</span>
                    <span class="ActionScriptBracket/Brace">}</span>
                <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptBracket/Brace">}</span>
    
            <span class="ActionScriptDefault_Text">propertyNames</span>.<span class="ActionScriptDefault_Text">sort</span><span class="ActionScriptBracket/Brace">(A</span><span class="ActionScriptDefault_Text">rray</span>.<span class="ActionScriptDefault_Text">CASEINSENSITIVE</span> <span class="ActionScriptOperator">|</span>
                               <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">numericIndex</span> <span class="ActionScriptOperator">?</span> <span class="ActionScriptDefault_Text">Array</span>.<span class="ActionScriptDefault_Text">NUMERIC</span> <span class="ActionScriptOperator">:</span> 0<span class="ActionScriptBracket/Brace">))</span>;
    
            <span class="ActionScriptComment">// dictionary keys can be indexed by an object reference
</span>            <span class="ActionScriptComment">// there&apos;s a possibility that two keys will have the same toString()
</span>            <span class="ActionScriptComment">// so we don&apos;t want to remove dupes
</span>            <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(!</span><span class="ActionScriptDefault_Text">isDict</span><span class="ActionScriptBracket/Brace">){</span>
                <span class="ActionScriptComment">// for Arrays, etc., on the other hand...
</span>                <span class="ActionScriptComment">// remove any duplicates, i.e. any items that can&apos;t be distingushed by toString()
</span>                <span class="ActionScriptReserved">for</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">i</span> <span class="ActionScriptOperator">=</span> 0; <span class="ActionScriptDefault_Text">i</span> <span class="ActionScriptOperator">&lt;</span> <span class="ActionScriptDefault_Text">propertyNames</span>.<span class="ActionScriptDefault_Text">length</span> <span class="ActionScriptOperator">-</span> 1; <span class="ActionScriptDefault_Text">i</span><span class="ActionScriptOperator">++</span><span class="ActionScriptBracket/Brace">){</span>
                    <span class="ActionScriptComment">// the list is sorted so any duplicates should be adjacent
</span>                    <span class="ActionScriptComment">// two properties are only equal if both the uri and local name are identical
</span>                    <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">propertyNames</span><span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptDefault_Text">i</span><span class="ActionScriptBracket/Brace">]</span>.<span class="ActionScriptDefault_Text">toString</span><span class="ActionScriptBracket/Brace">()</span> <span class="ActionScriptOperator">==</span> <span class="ActionScriptDefault_Text">propertyNames</span><span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptDefault_Text">i</span> <span class="ActionScriptOperator">+</span> 1<span class="ActionScriptBracket/Brace">]</span>.<span class="ActionScriptDefault_Text">toString</span><span class="ActionScriptBracket/Brace">()){</span>
                        <span class="ActionScriptDefault_Text">propertyNames</span>.<span class="ActionScriptDefault_Text">splice</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">i</span>, 1<span class="ActionScriptBracket/Brace">)</span>;
                        <span class="ActionScriptDefault_Text">i</span><span class="ActionScriptOperator">--</span>; <span class="ActionScriptComment">// back up
</span>                    <span class="ActionScriptBracket/Brace">}</span>
                <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptReserved">return</span> <span class="ActionScriptDefault_Text">result</span>;
        <span class="ActionScriptBracket/Brace">}</span>
    <span class="ActionScriptBracket/Brace">}</span>
<span class="ActionScriptBracket/Brace">}</span></pre></body>
</html>
